package com.example.service;

import com.example.controller.request.ShortLinkAddRequest;
import com.example.controller.request.ShortLinkDelRequest;
import com.example.controller.request.ShortLinkPageRequest;
import com.example.controller.request.ShortLinkUpdateRequest;
import com.example.model.EventMessage;
import com.example.model.ShortLinkDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.utils.JsonData;
import com.example.vo.ShortLinkVO;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author yinxin
 * @since 2022-06-08
 */
public interface ShortLinkService extends IService<ShortLinkDO> {

    /**
     * 解析短链
     * @param shortLinkCode
     * @return
     */
    ShortLinkVO parseShortLinkCode(String shortLinkCode);

    /**
     * 创建短链
     * @param request
     * @return
     */
    JsonData createShortLink(ShortLinkAddRequest request);

    /**
     * 处理短链消息(新增)
     * @param eventMessage
     * @return
     */
    Boolean handleAddShortLink(EventMessage eventMessage);

    /**
     * 处理短链消息(删除)
     * @param eventMessage
     * @return
     */
    Boolean handleDelShortLink(EventMessage eventMessage);

    /**
     * 处理短链消息(修改)
     * @param eventMessage
     * @return
     */
    Boolean handleUpdateShortLink(EventMessage eventMessage);

    /**
     * 分页查找短链
     */
    JsonData pageByGroupId(ShortLinkPageRequest request);

    /**
     * 删除短链
     * @param request
     * @return
     */
    JsonData del(ShortLinkDelRequest request);

    /**
     * 更新短链
     * @param request
     * @return
     */
    JsonData update(ShortLinkUpdateRequest request);

}
